package com.ruoyi.yijing.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.yijing.mapper.YjDaShangMapper;
import com.ruoyi.yijing.domain.YjDaShang;
import com.ruoyi.yijing.service.IYjDaShangService;

/**
 * 打赏的礼物Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-01-22
 */
@Service
public class YjDaShangServiceImpl implements IYjDaShangService 
{
    @Autowired
    private YjDaShangMapper yjDaShangMapper;

    /**
     * 查询打赏的礼物
     * 
     * @param shangId 打赏的礼物主键
     * @return 打赏的礼物
     */
    @Override
    public YjDaShang selectYjDaShangByShangId(Long shangId)
    {
        return yjDaShangMapper.selectYjDaShangByShangId(shangId);
    }

    /**
     * 查询打赏的礼物列表
     * 
     * @param yjDaShang 打赏的礼物
     * @return 打赏的礼物
     */
    @Override
    public List<YjDaShang> selectYjDaShangList(YjDaShang yjDaShang)
    {
        return yjDaShangMapper.selectYjDaShangList(yjDaShang);
    }

    /**
     * 新增打赏的礼物
     * 
     * @param yjDaShang 打赏的礼物
     * @return 结果
     */
    @Override
    public int insertYjDaShang(YjDaShang yjDaShang)
    {
        yjDaShang.setCreateBy(SecurityUtils.getUsername());
        yjDaShang.setCreateTime(new Date());
        return yjDaShangMapper.insertYjDaShang(yjDaShang);
    }

    /**
     * 修改打赏的礼物
     * 
     * @param yjDaShang 打赏的礼物
     * @return 结果
     */
    @Override
    public int updateYjDaShang(YjDaShang yjDaShang)
    {
        yjDaShang.setUpdateBy(SecurityUtils.getUsername());
        yjDaShang.setUpdateTime(new Date());
        return yjDaShangMapper.updateYjDaShang(yjDaShang);
    }

    /**
     * 批量删除打赏的礼物
     * 
     * @param shangIds 需要删除的打赏的礼物主键
     * @return 结果
     */
    @Override
    public int deleteYjDaShangByShangIds(Long[] shangIds)
    {
        return yjDaShangMapper.deleteYjDaShangByShangIds(shangIds);
    }

    /**
     * 删除打赏的礼物信息
     * 
     * @param shangId 打赏的礼物主键
     * @return 结果
     */
    @Override
    public int deleteYjDaShangByShangId(Long shangId)
    {
        return yjDaShangMapper.deleteYjDaShangByShangId(shangId);
    }
}
